package org.komarichin.beans.dao;

import org.komarichin.beans.IFile;

import java.util.Collection;

/**
 * interface describe dao bean for file object
 * User: Mykhaylo Komarichyn
 * Date: 31.12.2009
 * Time: 10:54:08
 */
public interface IFileDAO<T extends IFile, PK> extends IGenericDAO<T, PK> {
    /**
     * save file in folder
     *
     * @param file   file for saving
     * @param folder folder which contain file
     * @return saved file
     */
    public IFile<PK> save(T file, T folder);

    /**
     * load files for folder
     *
     * @param folderName folder path
     * @return collection of files
     */
    public Collection<T> getFiles(String folderName);

    /**
     * load files and folder in folder path
     *
     * @param folderName folder path
     * @return collection of files and folders
     */
    public Collection<T> getFilesAndFolders(String folderName);

    /**
     * checking file in folder
     *
     * @param fileName file
     * @param folder   folder
     * @return true if file exists in folder
     */
    public boolean exists(String fileName, String folder);

    /**
     * checking folder on empty
     *
     * @param folder folder path
     * @return true if folder empty
     */
    public boolean isFolderEmpty(String folder);

    /**
     * load folders by folder path
     *
     * @param currentFolder current folder
     * @return collection of folders in current folder
     */
    public Collection<String> getFolders(String currentFolder);

}
